package com.cyj.dream.admin.service.system.impl;

import com.cyj.dream.admin.model.system.SysPermission;
import com.cyj.dream.admin.persistence.manager.systems.SysPermissionManager;
import com.cyj.dream.admin.service.system.SysPermissionService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * @Description: 系统权限类业务层实现类
 * @BelongsProject: dream-DreamChardonnay
 * @BelongsPackage: com.dream.DreamChardonnay.service.impl
 * @Author: ChenYongJia
 * @CreateTime: 2021-04-02 09:25
 * @Email: chen87647213@163.com
 * @Version: 1.0
 */
@Slf4j
@Service
public class SysPermissionServiceImpl implements SysPermissionService {

    @Autowired
    private SysPermissionManager sysPermissionManager;
    
    /**
     * 根据用户id查询用户权限集
     * @param sysUserId 
     * @return java.util.List<com.dream.DreamChardonnay.model.system.SysPermission>
     * @date 2021/4/2 9:50
     * @author ChenYongJia
     * @version 1.0
     */
    @Override
    public List<SysPermission> findByUserId(Long sysUserId) {
        return null;
    }

    /**
     * 查询当前系统所有权限信息
     *
     * @return java.util.string
     * @date 2021/5/18 11:21
     * @author ChenYongJia
     * @version 1.0
     */
    @Override
    public List<String> queryAll(){
        List<String> pList = new ArrayList<>();
        sysPermissionManager.queryAll().stream().forEach(item->{
            pList.add(item.getSysPermissionValue());
        });
        return pList;
    }

    /**
     * 批量插入权限数据
     *
     * @param pList 系统权限集合
     * @return boolean
     * @date 2021/5/18 11:39
     * @author ChenYongJia
     * @version 1.0
     */
    @Override
    public boolean batchInsert(List<SysPermission> pList){
        return sysPermissionManager.batchInsert(pList);
    }
    
}
